/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Codigo;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.List;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;

/**
 *
 * @author kyerte
 */
public class FrmUsuarios extends javax.swing.JFrame {
    
    private ConsultaUsuarios consultaUsuarios;
    private List<Usuario> resultadoUsuarios;
    private Usuario usuarioActual;
    private int numeroUsuarios;
    private int indiceActual;
    private int idUsuario;
    private boolean nuevoUsuario;
    
    public FrmUsuarios() {
        initComponents();
        txtPassword2.setVisible(false);
        lblPassword2.setVisible(false);
        this.setIconImage(new ImageIcon(getClass().getResource("/Imagenes/Usuarios.png")).getImage());
        this.getContentPane().setBackground(new java.awt.Color(244, 243, 176));
        
        consultaUsuarios = new ConsultaUsuarios();
        
        explorarUsuarios();
        
        txtUsuario.addKeyListener(new KeyListener() {
            @Override
            public void keyTyped(KeyEvent e) {
            }
            
            @Override
            public void keyPressed(KeyEvent arg0) {
                txtPassword2.setVisible(true);
                lblPassword2.setVisible(true);
                validate();
            }
            
            @Override
            public void keyReleased(KeyEvent arg0) {
            }
        });
        
        txtPassword.addKeyListener(new KeyListener() {
            @Override
            public void keyTyped(KeyEvent e) {
                
                if (txtPassword.getText().length() == 45) {
                    e.consume();
                    
                }
            }
            
            @Override
            public void keyPressed(KeyEvent arg0) {
                txtPassword2.setVisible(true);
                lblPassword2.setVisible(true);
                validate();
            }
            
            @Override
            public void keyReleased(KeyEvent arg0) {
            }
        });
    }
    
    private void explorarUsuarios() {
        resultadoUsuarios = consultaUsuarios.consultarUsuarios();
        numeroUsuarios = resultadoUsuarios.size();
        
        lblPassword2.setVisible(false);
        txtPassword2.setVisible(false);
        txtPassword2.setText("");
        
        if (numeroUsuarios != 0) {
            
            indiceActual = 0;
            
            usuarioActual = resultadoUsuarios.get(indiceActual);
            idUsuario = usuarioActual.obtenerIdUsuario();
            txtUsuario.setText(usuarioActual.obtenerUsuario());
            txtPassword.setText(usuarioActual.obtenerPassword());
            chkAdministrador.setSelected(usuarioActual.obtenerAdministrador());
            
            txtIndiceActual.setText("" + (indiceActual + 1));
            lblTotal.setText("" + numeroUsuarios);
            
        } else {
            cmdGuardar.setEnabled(false);
            cmdCancelar.setEnabled(false);
            cmdEliminar.setEnabled(false);
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lblNombre = new javax.swing.JLabel();
        txtUsuario = new javax.swing.JTextField();
        lblPassword = new javax.swing.JLabel();
        cmdNuevo = new javax.swing.JButton();
        cmdGuardar = new javax.swing.JButton();
        cmdEliminar = new javax.swing.JButton();
        cmdCancelar = new javax.swing.JButton();
        cmdPrimero = new javax.swing.JButton();
        cmdAnterior = new javax.swing.JButton();
        txtIndiceActual = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        lblTotal = new javax.swing.JLabel();
        cmdSiguiente = new javax.swing.JButton();
        txtUltimo = new javax.swing.JButton();
        txtPassword = new javax.swing.JPasswordField();
        txtPassword2 = new javax.swing.JPasswordField();
        lblPassword2 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        chkAdministrador = new javax.swing.JCheckBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Usuarios");
        setResizable(false);

        lblNombre.setFont(new java.awt.Font("Ubuntu", 2, 18)); // NOI18N
        lblNombre.setText("Usuario");

        txtUsuario.setFont(new java.awt.Font("Ubuntu", 2, 18)); // NOI18N

        lblPassword.setFont(new java.awt.Font("Ubuntu", 2, 18)); // NOI18N
        lblPassword.setText("Contraseña");

        cmdNuevo.setBackground(new java.awt.Color(255, 255, 255));
        cmdNuevo.setFont(new java.awt.Font("Ubuntu", 2, 15)); // NOI18N
        cmdNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Nuevo.png"))); // NOI18N
        cmdNuevo.setMnemonic('n');
        cmdNuevo.setText("Nuevo");
        cmdNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdNuevoActionPerformed(evt);
            }
        });

        cmdGuardar.setBackground(new java.awt.Color(255, 255, 255));
        cmdGuardar.setFont(new java.awt.Font("Ubuntu", 2, 15)); // NOI18N
        cmdGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Guardar.png"))); // NOI18N
        cmdGuardar.setMnemonic('g');
        cmdGuardar.setText("Guardar");
        cmdGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdGuardarActionPerformed(evt);
            }
        });

        cmdEliminar.setBackground(new java.awt.Color(255, 255, 255));
        cmdEliminar.setFont(new java.awt.Font("Ubuntu", 2, 15)); // NOI18N
        cmdEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Borrar.png"))); // NOI18N
        cmdEliminar.setMnemonic('e');
        cmdEliminar.setText("Eliminar");
        cmdEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdEliminarActionPerformed(evt);
            }
        });

        cmdCancelar.setBackground(new java.awt.Color(255, 255, 255));
        cmdCancelar.setFont(new java.awt.Font("Ubuntu", 2, 15)); // NOI18N
        cmdCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Cancelar.png"))); // NOI18N
        cmdCancelar.setMnemonic('c');
        cmdCancelar.setText("Cancelar");
        cmdCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdCancelarActionPerformed(evt);
            }
        });

        cmdPrimero.setBackground(new java.awt.Color(255, 255, 255));
        cmdPrimero.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/First.png"))); // NOI18N
        cmdPrimero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdPrimeroActionPerformed(evt);
            }
        });

        cmdAnterior.setBackground(new java.awt.Color(255, 255, 255));
        cmdAnterior.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Back.png"))); // NOI18N
        cmdAnterior.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdAnteriorActionPerformed(evt);
            }
        });

        txtIndiceActual.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtIndiceActualActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N
        jLabel1.setText("/");

        lblTotal.setFont(new java.awt.Font("Ubuntu", 0, 24)); // NOI18N
        lblTotal.setText("100");

        cmdSiguiente.setBackground(new java.awt.Color(255, 255, 255));
        cmdSiguiente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Last.png"))); // NOI18N
        cmdSiguiente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdSiguienteActionPerformed(evt);
            }
        });

        txtUltimo.setBackground(new java.awt.Color(255, 255, 255));
        txtUltimo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Forward.png"))); // NOI18N
        txtUltimo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtUltimoActionPerformed(evt);
            }
        });

        txtPassword.setFont(new java.awt.Font("Ubuntu", 2, 18)); // NOI18N

        txtPassword2.setFont(new java.awt.Font("Ubuntu", 2, 18)); // NOI18N

        lblPassword2.setFont(new java.awt.Font("Ubuntu", 2, 18)); // NOI18N
        lblPassword2.setText("Confirmar");

        chkAdministrador.setBackground(new java.awt.Color(244, 243, 176));
        chkAdministrador.setText("Administrador");
        chkAdministrador.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chkAdministradorActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(cmdNuevo)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(cmdGuardar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(cmdEliminar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(cmdCancelar))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(lblPassword, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(lblNombre, javax.swing.GroupLayout.Alignment.TRAILING))
                            .addComponent(lblPassword2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtPassword2)
                            .addComponent(txtUsuario, javax.swing.GroupLayout.DEFAULT_SIZE, 337, Short.MAX_VALUE)
                            .addComponent(txtPassword, javax.swing.GroupLayout.DEFAULT_SIZE, 337, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addComponent(chkAdministrador)))
                .addContainerGap(187, Short.MAX_VALUE))
            .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(cmdPrimero)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cmdAnterior)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtIndiceActual, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1)
                .addGap(9, 9, 9)
                .addComponent(lblTotal)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cmdSiguiente)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtUltimo)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblNombre)
                    .addComponent(chkAdministrador))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblPassword)
                    .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtPassword2, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblPassword2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(cmdGuardar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(cmdEliminar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(cmdCancelar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cmdNuevo, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cmdAnterior, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(lblTotal, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel1))
                    .addComponent(cmdPrimero, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(txtUltimo, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(cmdSiguiente, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addComponent(txtIndiceActual, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(19, 19, 19))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void cmdNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdNuevoActionPerformed
        nuevoUsuario = true;
        txtUsuario.setText("");
        txtPassword.setText("");
        txtPassword2.setText("");
        chkAdministrador.setSelected(false);
        cmdGuardar.setEnabled(true);
        cmdCancelar.setEnabled(true);
        cmdEliminar.setEnabled(false);
    }//GEN-LAST:event_cmdNuevoActionPerformed
    
    private void cmdGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdGuardarActionPerformed
        cmdGuardar.setEnabled(true);
        cmdCancelar.setEnabled(true);
        
        String mensaje = "";
        
        int resultado = 0;
        
        if (coincidenPasswords(txtPassword.getText(), txtPassword2.getText())) {
            
            if (nuevoUsuario) {
                resultado = consultaUsuarios.insertarNuevoUsuario(txtUsuario.getText(),
                        txtPassword.getText(), chkAdministrador.isSelected());
                mensaje = "Se agregó nuevo usuario";
            } else {
                resultado = consultaUsuarios.actualizarUsuario(txtUsuario.getText(),
                        txtPassword.getText(), chkAdministrador.isSelected(), idUsuario);
                mensaje = "Se actualizó usuario";
            }
            
            if (resultado == 1) {
                JOptionPane.showMessageDialog(null, mensaje,
                        "Usuarios", JOptionPane.INFORMATION_MESSAGE);
            } else {
                JOptionPane.showMessageDialog(null, "No se pudo realizar la operación",
                        "Usuarios", JOptionPane.ERROR_MESSAGE);
            }
            
            nuevoUsuario = false;
            explorarUsuarios();
            
            cmdNuevo.setEnabled(true);
            cmdEliminar.setEnabled(true);
            
        } else {
            
            JOptionPane.showMessageDialog(null, "No coincide la contraseña",
                    "Usuarios", JOptionPane.WARNING_MESSAGE);
            
            txtPassword.requestFocus();
            txtPassword.setSelectionEnd(txtPassword.getText().length());
        }
        
    }//GEN-LAST:event_cmdGuardarActionPerformed
    public boolean coincidenPasswords(String pass1, String pass2) {
        boolean coinciden = false;
        if (pass1.equals(pass2)) {
            coinciden = true;
        }
        return coinciden;
    }
    private void txtIndiceActualActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtIndiceActualActionPerformed
        String str = txtIndiceActual.getText();
        
        lblPassword2.setVisible(false);
        txtPassword2.setVisible(false);
        txtPassword2.setText("");
        
        if (ValidaNumeros.validarNumeroEntero(str)) {
            
            indiceActual = (Integer.parseInt(str) - 1);
            
            if (numeroUsuarios != 0 && indiceActual < numeroUsuarios) {
                
                usuarioActual = resultadoUsuarios.get(indiceActual);
                idUsuario = usuarioActual.obtenerIdUsuario();
                txtUsuario.setText(usuarioActual.obtenerUsuario());
                txtPassword.setText(usuarioActual.obtenerPassword());
                chkAdministrador.setSelected(usuarioActual.obtenerAdministrador());
            }
            
        } else {
            JOptionPane.showMessageDialog(null, "Ingresa un número válido",
                    "Usuarios", JOptionPane.ERROR_MESSAGE);
            explorarUsuarios();
        }
    }//GEN-LAST:event_txtIndiceActualActionPerformed
    
    private void cmdEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdEliminarActionPerformed
        int opc = JOptionPane.showConfirmDialog(this, "¿Seguro que deseas eliminar este usuario?",
                "Usuarios", JOptionPane.YES_NO_OPTION);
        
        int resultado = 0;
        
        if (opc == JOptionPane.YES_OPTION) {
            
            resultado = consultaUsuarios.eliminarUsuario(idUsuario);
            
            if (resultado != 0) {
                
                JOptionPane.showMessageDialog(null, "Usuario eliminado",
                        "Usuario", JOptionPane.INFORMATION_MESSAGE);
                
                explorarUsuarios();
                
            } else {
                JOptionPane.showMessageDialog(null, "No se pudo eliminar usuario",
                        "Usuarios", JOptionPane.INFORMATION_MESSAGE);
            }
        }
        
        cmdNuevo.setEnabled(true);
        cmdGuardar.setEnabled(true);
        cmdCancelar.setEnabled(true);
        cmdEliminar.setEnabled(true);
    }//GEN-LAST:event_cmdEliminarActionPerformed
    
    private void cmdPrimeroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdPrimeroActionPerformed
        indiceActual = 0;
        txtIndiceActual.setText("" + (indiceActual + 1));
        txtIndiceActualActionPerformed(evt);
    }//GEN-LAST:event_cmdPrimeroActionPerformed
    
    private void cmdAnteriorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdAnteriorActionPerformed
        indiceActual--;
        
        if (indiceActual < 0) {
            indiceActual = numeroUsuarios - 1;
        }
        
        txtIndiceActual.setText("" + (indiceActual + 1));
        txtIndiceActualActionPerformed(evt);
    }//GEN-LAST:event_cmdAnteriorActionPerformed
    
    private void cmdSiguienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdSiguienteActionPerformed
        indiceActual++;
        
        if (indiceActual >= numeroUsuarios) {
            indiceActual = 0;
        }
        
        txtIndiceActual.setText("" + (indiceActual + 1));
        txtIndiceActualActionPerformed(evt);
    }//GEN-LAST:event_cmdSiguienteActionPerformed
    
    private void txtUltimoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtUltimoActionPerformed
        indiceActual = numeroUsuarios - 1;
        
        txtIndiceActual.setText("" + (indiceActual + 1));
        
        txtIndiceActualActionPerformed(evt);
    }//GEN-LAST:event_txtUltimoActionPerformed
    
    private void cmdCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdCancelarActionPerformed
        explorarUsuarios();
    }//GEN-LAST:event_cmdCancelarActionPerformed
    
    private void chkAdministradorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkAdministradorActionPerformed
        txtPassword2.setVisible(true);
    }//GEN-LAST:event_chkAdministradorActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox chkAdministrador;
    private javax.swing.JButton cmdAnterior;
    private javax.swing.JButton cmdCancelar;
    private javax.swing.JButton cmdEliminar;
    private javax.swing.JButton cmdGuardar;
    private javax.swing.JButton cmdNuevo;
    private javax.swing.JButton cmdPrimero;
    private javax.swing.JButton cmdSiguiente;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JLabel lblNombre;
    private javax.swing.JLabel lblPassword;
    private javax.swing.JLabel lblPassword2;
    private javax.swing.JLabel lblTotal;
    private javax.swing.JTextField txtIndiceActual;
    private javax.swing.JPasswordField txtPassword;
    private javax.swing.JPasswordField txtPassword2;
    private javax.swing.JButton txtUltimo;
    private javax.swing.JTextField txtUsuario;
    // End of variables declaration//GEN-END:variables
}
